package org.yufan.interceptor;

import org.yufan.bean.User;

/**
 * Created by zxd on 2018/4/12.
 */
public class UserThreadLocal {

    private static final ThreadLocal<User> THREAD_LOCAL=new ThreadLocal<User>();

    /**
     * 往当前线程绑定用户
     */
    public static void set(User user){
        THREAD_LOCAL.set(user);
    }

    /**
     * 获得当前线程绑定的user
     */
    public static User get(){
        return THREAD_LOCAL.get();
    }
}
